<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Test</title>
    <script src="../static/js/jquery.min.js"></script>
</head>
<body>
    <script>
        function selectAll() {
            $.ajax({
                url: 'http://42.193.148.6:8000/test_json',
                type: 'get',
                dataType: 'json',
                data: '',
                success: function (data) {
                    var html = '';
                    $.each(data, function (index, element) {
                        html += '<tr>' +
                            '    <td>' + element.name + '</td>' +
                            '    <td>' + element.age + '</td>' +
                            '    <td>' + element.sex + '</td>' +
                            '</tr>';
                    });
                    $("#table").append(html);
                },
                error: function () {
                    alert('服务器超时，请重试！');
                }
            });
        }
    </script>

<div style="text-align: left;width: 500px;margin:0 auto">

    <input type="button" value="查询" onclick="selectAll()">
    <br><br>

    <table id="table" border="1" width="500" cellspacing="0">
        <tr>
            <td>姓名</td>
            <td>年龄</td>
            <td>性别</td>
        </tr>
        <tr>
            <td>宋江</td>
            <td>50</td>
            <td>男</td>
        </tr>

    </table>

</div>
</body>

</html>>